<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:p="http://primefaces.org/ui">

    <ui:composition>

        <p:dialog id="ExcursionCreateDlg" widgetVar="ExcursionCreateDialog" modal="true" resizable="false" appendToBody="true" header="#{bundle.CreateExcursionTitle}" closeOnEscape="true">

            <h:form id="ExcursionCreateForm">

                <h:panelGroup id="display">
                    <p:panelGrid columns="2">

                        <p:outputLabel value="#{bundle.CreateExcursionLabel_excursionId}" for="excursionId" />
                        <p:inputText id="excursionId" value="#{excursionController.selected.excursionId}" title="#{bundle.CreateExcursionTitle_excursionId}" required="true" requiredMessage="#{bundle.CreateExcursionRequiredMessage_excursionId}"/>

                        <p:outputLabel value="#{bundle.CreateExcursionLabel_route}" for="route" />
                        <p:inputText id="route" value="#{excursionController.selected.route}" title="#{bundle.CreateExcursionTitle_route}" size="45" maxlength="45"/>

                        <p:outputLabel value="#{bundle.CreateExcursionLabel_date}" for="date" />
                        <p:calendar id="date" pattern="MM/dd/yyyy" value="#{excursionController.selected.date}" title="#{bundle.EditExcursionTitle_date}"  showOn="button"/>

                        <p:outputLabel value="#{bundle.CreateExcursionLabel_price}" for="price" />
                        <p:inputText id="price" value="#{excursionController.selected.price}" title="#{bundle.CreateExcursionTitle_price}"/>

                        <p:outputLabel value="#{bundle.CreateExcursionLabel_product}" for="product" />
                        <p:selectOneMenu id="product" value="#{excursionController.selected.product}" required="true" requiredMessage="#{bundle.EditExcursionRequiredMessage_product}" converter="productConverter">
                            <f:selectItem itemLabel="#{bundle.SelectOneMessage}"/>
                            <f:selectItems value="#{productController.items}"
                                           var="productItem"
                                           itemValue="#{productItem}"
                                           itemLabel="#{productItem.productId.toString()}"
                                           />

                        </p:selectOneMenu>
                    </p:panelGrid>
                    <p:commandButton actionListener="#{excursionController.saveNew}" value="#{bundle.Save}" update="display,:ExcursionListForm:datalist,:growl" oncomplete="handleSubmit(xhr,status,args,ExcursionCreateDialog);"/>
                    <p:commandButton value="#{bundle.Cancel}" onclick="ExcursionCreateDialog.hide()"/>
                </h:panelGroup>

            </h:form>

        </p:dialog>

    </ui:composition>

</html>
